package com.sangcomz.fishbun.datasource;

import com.sangcomz.fishbun.Fishton;
import com.sangcomz.fishbun.MimeType;
import com.sangcomz.fishbun.adapter.image.ImageAdapter;
import com.sangcomz.fishbun.ui.album.model.AlbumMenuViewData;
import com.sangcomz.fishbun.ui.album.model.AlbumViewData;
import com.sangcomz.fishbun.ui.detail.model.DetailImageViewData;
import com.sangcomz.fishbun.ui.picker.model.PickerMenuViewData;
import com.sangcomz.fishbun.ui.picker.model.PickerViewData;
import ohos.utils.net.Uri;

import java.util.List;

public class FishBunDataSourceImpl implements FishBunDataSource {

    private Fishton fishton;
    public FishBunDataSourceImpl(Fishton fishton){
        this.fishton = fishton;
    }

    @Override
    public List<Uri> getSelectedImageList() {
        return fishton.selectedImages;
    }

    @Override
    public void selectImage(Uri imageUri) {
        fishton.selectedImages.add(imageUri);
    }

    @Override
    public void unselectImage(Uri imageUri) {
        fishton.selectedImages.remove(imageUri);
    }

    @Override
    public List<Uri> getPickerImages() {
        return fishton.currentPickerImageList;
    }

    @Override
    public int getMaxCount() {
        return fishton.maxCount;
    }

    @Override
    public int getMinCount() {
        return fishton.minCount;
    }

    @Override
    public boolean getIsAutomaticClose() {
        return fishton.isAutomaticClose;
    }

    @Override
    public String getMessageLimitReached() {
        return fishton.messageLimitReached;
    }

    @Override
    public String getMessageNothingSelected() {
        return fishton.messageNothingSelected;
    }

    @Override
    public List<MimeType> getExceptMimeTypeList() {
        return fishton.exceptMimeTypeList;
    }

    @Override
    public List<String> getSpecifyFolderList() {
        return fishton.specifyFolderList;
    }

    @Override
    public String getAllViewTitle() {
        return fishton.titleAlbumAllView;
    }

    @Override
    public DetailImageViewData getDetailViewData() {
        return new DetailImageViewData(
                fishton.colorStatusBar,
                fishton.isStatusBarLight,
                fishton.colorActionBar,
                fishton.colorActionBarTitle,
                fishton.colorSelectCircleStroke
        );
    }

    @Override
    public AlbumViewData getAlbumViewData() {
        return new AlbumViewData(
                fishton.colorStatusBar,
                fishton.isStatusBarLight,
                fishton.colorActionBar,
                fishton.colorActionBarTitle,
                fishton.titleActionBar,
                fishton.drawableHomeAsUpIndicator,
                fishton.albumPortraitSpanCount,
                fishton.albumLandscapeSpanCount,
                fishton.albumThumbnailSize,
                fishton.maxCount,
                fishton.isShowCount
        );
    }

    @Override
    public ImageAdapter getImageAdapter() {
        return fishton.imageAdapter;
    }

    @Override
    public AlbumMenuViewData gatAlbumMenuViewData() {
        return new AlbumMenuViewData(
                fishton.hasButtonInAlbumActivity,
                fishton.drawableDoneButton,
                fishton.strDoneMenu,
                fishton.colorTextMenu
        );
    }

    @Override
    public PickerViewData getPickerViewData() {
        return new PickerViewData(
                fishton.colorStatusBar,
                fishton.isStatusBarLight,
                fishton.colorActionBar,
                fishton.colorActionBarTitle,
                fishton.titleActionBar,
                fishton.drawableHomeAsUpIndicator,
                fishton.albumPortraitSpanCount,
                fishton.albumLandscapeSpanCount,
                fishton.albumThumbnailSize,
                fishton.maxCount,
                fishton.isShowCount,
                fishton.colorSelectCircleStroke,
                fishton.isAutomaticClose,
                fishton.photoSpanCount
        );
    }

    @Override
    public void setCurrentPickerImageList(List<Uri> pickerImageList) {
        fishton.currentPickerImageList = pickerImageList;
    }

    @Override
    public boolean hasCameraInPickerPage() {
        return fishton.hasCameraInPickerPage;
    }

    @Override
    public boolean useDetailView() {
        return fishton.isUseDetailView;
    }

    @Override
    public PickerMenuViewData getPickerMenuViewData() {
        return new PickerMenuViewData(
                fishton.drawableDoneButton,
                fishton.drawableAllDoneButton,
                fishton.strDoneMenu,
                fishton.colorTextMenu,
                fishton.strAllDoneMenu,
                fishton.isUseAllDoneButton
        );
    }

    @Override
    public boolean isStartInAllView() {
        return fishton.isStartInAllView;
    }
}